package com.kmstech.greeting.cli;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public final class Console {
  private static final BufferedReader reader = new BufferedReader(
      new InputStreamReader(System.in));

  public static void write(String fmt, Object... args) {
    System.out.printf(fmt, args);
  }

  public static void writeLine() {
    System.out.printf("\r\n");
  }

  public static void writeLine(String fmt, Object... args) {
    write(fmt, args);
    writeLine();
  }

  public static String readLine() {
    try {
      return reader.readLine();
    }
    catch (IOException e) {
      return null;
    }
  }

  public static String readLine(String fmt, Object... args) {
    write(fmt, args);
    return readLine();
  }
}
